package com.ruoyi.hualian.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hualian.mapper.HlOtherCommodityMapper;
import com.ruoyi.hualian.domain.HlOtherCommodity;
import com.ruoyi.hualian.service.IHlOtherCommodityService;

/**
 * 其他型号Service业务层处理
 * 
 * @author hujian
 */
@Service
public class HlOtherCommodityServiceImpl implements IHlOtherCommodityService 
{
    @Autowired
    private HlOtherCommodityMapper hlOtherCommodityMapper;

    /**
     * 根据已知信息查询具体对象信息
     * @param hlOtherCommodity 已知信息
     * @return 具体对象信息
     */
    @Override
    public HlOtherCommodity selectOne(HlOtherCommodity hlOtherCommodity) {

        LambdaQueryWrapper<HlOtherCommodity> hlOtherCommodityWrapper = new LambdaQueryWrapper<>();

        hlOtherCommodityWrapper.eq(HlOtherCommodity::getCode, hlOtherCommodity.getCode());

        if (ObjectUtils.isNotEmpty(hlOtherCommodity.getBandwidth())) {
            hlOtherCommodityWrapper.eq(HlOtherCommodity::getBandwidth, hlOtherCommodity.getBandwidth());
        }
        if (ObjectUtils.isNotEmpty(hlOtherCommodity.getMerchantCode())) {
            hlOtherCommodityWrapper.eq(HlOtherCommodity::getMerchantCode, hlOtherCommodity.getMerchantCode());
        }
        return hlOtherCommodityMapper.selectOne(hlOtherCommodityWrapper);
    }

    /**
     * 根据集合插入数据库
     * @param hlOtherCommodityList 集合
     * @return 结果
     */
    @Override
    public int insertList(List<HlOtherCommodity> hlOtherCommodityList) {
        return hlOtherCommodityMapper.insertList(hlOtherCommodityList);
    }


    /**
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     */


    /**
     * 查询其他型号
     * 
     * @param otherId 其他型号主键
     * @return 其他型号
     */
    @Override
    public HlOtherCommodity selectHlOtherCommodityByOtherId(Long otherId)
    {
        return hlOtherCommodityMapper.selectHlOtherCommodityByOtherId(otherId);
    }

    /**
     * 查询其他型号列表
     * 
     * @param hlOtherCommodity 其他型号
     * @return 其他型号
     */
    @Override
    public List<HlOtherCommodity> selectHlOtherCommodityList(HlOtherCommodity hlOtherCommodity)
    {
        return hlOtherCommodityMapper.selectHlOtherCommodityList(hlOtherCommodity);
    }

    /**
     * 新增其他型号
     * 
     * @param hlOtherCommodity 其他型号
     * @return 结果
     */
    @Override
    public int insertHlOtherCommodity(HlOtherCommodity hlOtherCommodity)
    {
        return hlOtherCommodityMapper.insertHlOtherCommodity(hlOtherCommodity);
    }

    /**
     * 修改其他型号
     * 
     * @param hlOtherCommodity 其他型号
     * @return 结果
     */
    @Override
    public int updateHlOtherCommodity(HlOtherCommodity hlOtherCommodity)
    {
        return hlOtherCommodityMapper.updateHlOtherCommodity(hlOtherCommodity);
    }

    /**
     * 批量删除其他型号
     * 
     * @param otherIds 需要删除的其他型号主键
     * @return 结果
     */
    @Override
    public int deleteHlOtherCommodityByOtherIds(Long[] otherIds)
    {
        return hlOtherCommodityMapper.deleteHlOtherCommodityByOtherIds(otherIds);
    }

    /**
     * 删除其他型号信息
     * 
     * @param otherId 其他型号主键
     * @return 结果
     */
    @Override
    public int deleteHlOtherCommodityByOtherId(Long otherId)
    {
        return hlOtherCommodityMapper.deleteHlOtherCommodityByOtherId(otherId);
    }
}
